//
//  AttachInfo.m
//  EpointFrame5
//
//  Created by Pill Gong on 14-2-24.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "AttachInfo.h"

@implementation AttachInfo

- (BOOL)fileIsDirectory {
    if ([_fileName isEqualToString:@""] || _fileName == nil) {
        _isDirectory = NO;
        return NO;
    } else {
        return [[NSFileManager defaultManager] fileExistsAtPath:_filePath isDirectory:&_isDirectory];
    }
}

- (void)setFileName:(NSString *)fileName {
    _fileName = fileName;
    NSString *documentPath = [self getDocumentPath];
    _filePath = [NSString stringWithFormat:@"%@/%@", documentPath, _fileName];
}

- (NSString *)getDocumentPath {
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
    NSArray *array = [[NSFileManager defaultManager] subpathsAtPath:documentPath];
    return [array firstObject];
}

@end
